package org.hw.proxy.cglib;

import net.sf.cglib.core.DebuggingClassWriter;
import net.sf.cglib.proxy.Enhancer;
import org.hw.proxy.Dog;

public class CGlibApp {
    public static void main(String[] args){
        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, "D:\\cgcode");

        Enhancer enhancer=new Enhancer();
        enhancer.setSuperclass(Dog.class);
        enhancer.setCallback(new AnimalInterceptor());
        Dog dogProxy=(Dog)enhancer.create();
        dogProxy.eating("apple");
        dogProxy.sleep("scrapy");
    }
}
